/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.naga.bulksender.service.util;

import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;


/**
 *
 * @author Naga Services
 *
 * Service Locater Implementation to provide access to Spring Beans
 */
public class ServiceLocator {

    private static final  Log log = LogFactory.getLog(ServiceLocator.class);
    private  AbstractApplicationContext ctx = null;
    private static ServiceLocator instance = new ServiceLocator();

    private ServiceLocator(){
         ctx = new ClassPathXmlApplicationContext("conf/applicationContext.xml");
    }

    public static ServiceLocator getInstance(){
        return instance;
    }

    public Object getObject(String name){
        log.info("Gettign the follow Bean => " + name);
        Object obj = null;
        obj = ctx.getBean(name);
        return obj;
    }
}
